package com.kelvin.oocl.threadLocal;

import com.kelvin.oocl.testTransaction.tool.DBUtils;

public class ThreadLocalTest {
    public static void main(String[] args) {
        new Thread("Thread-1") {
            @Override
            public void run() {
                for (int i = 0; i < 3; i++) {
                    System.out.println(Thread.currentThread().getName() + "-> " + DBUtils.getConnection());
                }
            }
        }.start();
        new Thread("Thread-2") {
            @Override
            public void run() {
                for (int i = 0; i < 3; i++) {
                    System.out.println(Thread.currentThread().getName() + "-> " + DBUtils.getConnection());
                }
            }
        }.start();
    }
}
